package com.ripplezjw.blog.controller;

import com.ripplezjw.blog.Service.TagService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;

@Controller
public class TagController {
    @Autowired
    TagService tagService;

    @GetMapping("/tagId/{tagId}")
    public String tagList(@PathVariable("tagId") int tagId,
                          Model model) {
        model.addAttribute("articles", tagService.getAllArticleByTagId(tagId));
        return "articleList";
    }
}
